package flc.ast.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import flc.ast.BaseAc;
import flc.ast.R;
import flc.ast.databinding.ActivityDetailBinding;
import stark.common.basic.event.EventStatProxy;
import stark.common.basic.utils.IntentUtil;
import stark.common.bean.StkResBean;

public class DetailActivity extends BaseAc<ActivityDetailBinding> {

    public static StkResBean stkResBean;

    @Override
    protected int onCreate() {
        return R.layout.activity_detail;
    }

    @Override
    protected void initView() {
        EventStatProxy.getInstance().statEvent1(this, mDataBinding.event1Container);

        mDataBinding.ivDetailBack.setOnClickListener(v -> onBackPressed());

        mDataBinding.ivDetailShare.setOnClickListener(this);
    }

    @Override
    protected void onClickCallback(View v) {
        switch (v.getId()) {
            case R.id.ivDetailShare://分享
                IntentUtil.shareText(mContext, stkResBean.getUrl());
                break;
        }
    }

    @Override
    protected void initData() {
        mDataBinding.webView.getSettings().setJavaScriptEnabled(true);
        mDataBinding.webView.setBackgroundColor(Color.TRANSPARENT);
        mDataBinding.webView.loadUrl(stkResBean.getUrl());
    }
}